package com.example.demo.collection;

import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.Comparator;

/**
 * @desc: <br/>
 * @author: Jingbo Hu<br/>
 * @time：2020年07⽉01⽇<br/>
 * @version：v1.0.0<br>
 */
@Slf4j
public class ArrayListDemo {


    public static void main(String[] args) throws InterruptedException {

        int value1 = 10;
        int value3 = 60;
        int value2 = 30;
        ArrayList<Integer> arrayList = new ArrayList();

        arrayList.add(value1);
        arrayList.add(value3);
        arrayList.add(value2);
        arrayList.sort(Comparator.naturalOrder());

        String value = getValue(arrayList);
        System.out.println(value);
    }

    public static String getValue(ArrayList<Integer> arrayList){
        int temp = 0;
        int num = 49;
        for (int i = 0; i < arrayList.size(); i++) {
            Integer integer = arrayList.get(i);
            temp+=integer;
            if(num < temp){
                System.out.println(integer);
                return "12321";
            }
        }
        return null;
    }

}
